<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Recharge Customer</title>
</h:head>
<f:view>
	<body>
		<ui:composition template="../includes/template.xhtml">
			<ui:define name="mainbody">
				<center>

					<p:panel header="Student Status Update" style="min-height: 550px">


					<p:messages id="messages" showDetail="true" autoUpdate="true" />
					<center>
					<h:form id="form">
				    <p:dataTable style="width: 75%" id="students" var="student" value="#{studentStatusUpdateBean.studentsModel}" paginator="true" rows="10"
				                 selection="#{studentStatusUpdateBean.selectedStudentsList}">
				
				        <p:column selectionMode="multiple"  style="width:18px" />
				
				        <p:column headerText="Student Name" filterBy="#{student.name}" style="width:40%">
				            #{student.name}  
				        </p:column>
				        
				        <p:column headerText="Class" filterBy="#{student.section.clas.classTitle} #{student.section.sectionTitle}" style="width:40%">
				            #{student.section.clas.classTitle}  #{student.section.sectionTitle}  
				        </p:column>
				        
				        <p:column id="status" headerText="Current Status">
				            <p:graphicImage height="30" width="30" value="#{student.currentStatus eq true ? '../../images/enabled.png' : '../../images/disabled.png'}" />
				        </p:column>
				
				        <f:facet name="footer">
				            <p:commandButton id="multiViewButton" value="Change Status"
				                             update=":form:displayMulti" oncomplete="multiStudentDialog.show()"/>
				        </f:facet>
				    </p:dataTable>
				
				    <p:dialog id="multiDialog" header="Students' Detail" widgetVar="multiStudentDialog"
				              height="300" width="250" showEffect="fade" hideEffect="explode">
				
				        <p:dataList id="displayMulti"
				                value="#{studentStatusUpdateBean.selectedStudentsList}" var="selectedStudent">
				            Name: #{selectedStudent.name}  Status: #{selectedStudent.currentStatus}
				        </p:dataList>
				        
				        <table>
							<tr>
								<td><h:outputLabel>Change Status to:</h:outputLabel></td>
								<td>
									<p:selectOneRadio id="options"
										value="#{studentStatusUpdateBean.newStatus}">
										<f:selectItem itemLabel="Enable" itemValue="true" />
										<br />
										<f:selectItem itemLabel="Disable" itemValue="false" />
									</p:selectOneRadio>
								</td>
							</tr>			        	
				        </table>
						<p:commandButton id="submit" value="Update" type="submit" ajax="false" action="#{studentStatusUpdateBean.perform}"/>
				    </p:dialog>
				    </h:form>
				    </center>
</p:panel>

				</center>
			</ui:define>
		</ui:composition>
	</body>
</f:view>
</html>
